const KoaRouter = require('koa-router');

const commentRouter = new KoaRouter({prefix: '/comment'});

const {
  verifyAuth,
  verifyPermission
} = require('../middleware/auth.middleware');

const {
  create,
  replyComment,
  updatedComment,
  removeComment
} = require('../controller/comment.controller');

// 发布评论
commentRouter.post('/', verifyAuth, create);
// 回复评论
commentRouter.post('/:commentId/reply', verifyAuth, verifyPermission, replyComment);
// 修改评论
commentRouter.patch('/:commentId', verifyAuth, verifyPermission, updatedComment);
// 删除评论
commentRouter.delete('/:commentId', verifyAuth, verifyPermission, removeComment);

module.exports = commentRouter;